package com.demo.demos.filter;

import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import java.io.IOException;

/**
 * Created by Lenovo
 * DATA:2024/11/24 024
 **/
@Slf4j
@WebFilter(urlPatterns = "/*")//过滤所有请求
@Component
public class DemoFilter implements Filter {
    @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
        log.info("对request进行过滤");
        chain.doFilter(request, response);//对拦截进行放行
        log.info("对response进行过滤");
    }
}
